//
//  RootViewController.m
//  MyAppDemo
//
//  Created by 千锋 on 15/12/5.
//  Copyright (c) 2015年 Aike. All rights reserved.
//

#import "RootViewController.h"
#import "FirstViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "FourthViewController.h"

@interface RootViewController ()<UITabBarControllerDelegate>

@end

@implementation RootViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.delegate = self;
//    [self createViewControllers];
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)createViewControllers{
   FirstViewController * homeVC = [[FirstViewController alloc]init];
    homeVC.title = @"首页";
    UINavigationController * homeNavi = [[UINavigationController alloc]initWithRootViewController:homeVC];
    UITabBarItem * homeTabBarItem = [[UITabBarItem alloc]initWithTitle:@"首页" image:[UIImage imageNamed:@"tab_c0@2x.png"] tag:1];
    homeNavi.tabBarItem = homeTabBarItem;
    SecondViewController * secondVC = [[SecondViewController alloc]init];
    secondVC.title = @"播放器";
    UINavigationController * secondNavi = [[UINavigationController alloc]initWithRootViewController:secondVC];
    UITabBarItem * secondTabBarItem = [[UITabBarItem alloc]initWithTitle:@"播放器" image:[UIImage imageNamed:@"tab_c1@2x.png"] tag:2];
    secondVC.tabBarItem = secondTabBarItem;
    
    ThirdViewController * thirdVC = [[ThirdViewController alloc]init];
    //thirdVC.title = @"滚动视图";
    //UINavigationController * thirdNavi = [[UINavigationController alloc]initWithRootViewController:thirdVC];
    UITabBarItem * thirdTabBarItem = [[UITabBarItem alloc]initWithTitle:@"地图" image:[UIImage imageNamed:@"tab_c2@2x.png"] tag:3];
    thirdVC.tabBarItem = thirdTabBarItem;
    FourthViewController * fourthVC = [[FourthViewController alloc]init];
    fourthVC.title = @"动画";
    UINavigationController * fourthNavi = [[UINavigationController alloc]initWithRootViewController:fourthVC];
    UITabBarItem * fourthTabBarItem = [[UITabBarItem alloc]initWithTitle:@"动画" image:[UIImage imageNamed:@"tab_c3@2x.png"] tag:4];
    fourthNavi.tabBarItem = fourthTabBarItem;
    NSArray * viewControllers = @[homeNavi,secondNavi,thirdVC,fourthNavi];
    self.viewControllers = viewControllers;
    
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
